package com.olinsports.system.olinsportssystem.controller;

import com.olinsports.system.olinsportssystem.manager.SiteConsumptionDetailsManager;
import com.olinsports.system.olinsportssystem.model.SavingDetail;
import com.olinsports.system.olinsportssystem.model.SiteConsumptionDetails;
import com.olinsports.system.olinsportssystem.service.SavingDetailService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

/**
 * Created by Administrator on 2017/7/22.
 */
@Controller
@RequestMapping("siteDeatils")
public class SiteConsumptionDetailsController {
    @Autowired
    private SiteConsumptionDetailsManager siteConsumptionDetailsManager;

    @RequestMapping("/selectBySaveKey")
    @ResponseBody
    public SiteConsumptionDetails selectByKey(int siteDeatilsKey){
        return siteConsumptionDetailsManager.selectByKey(siteDeatilsKey);
    }
    @RequestMapping("/listSiteDetails")
    @ResponseBody
    public Map listSiteDetails(String page, String rows,String sord, String sidx){
        return siteConsumptionDetailsManager.listSiteDetails(page,rows,sord,sidx);
    }

    @RequestMapping("/searchDate")
    @ResponseBody
    public Map searchDate(String page, String rows,String startDate,String endDate){
        return siteConsumptionDetailsManager.searchDate(page,rows,startDate,endDate);
    }

    @RequestMapping("/toDcExcel")
    @ResponseBody
    public ModelAndView toDcExcel(String startDate, String endDate, HSSFWorkbook workbook) throws Exception{
        return siteConsumptionDetailsManager.toDcExcel(startDate,endDate,workbook);
    }

    @RequestMapping("/searchSelf")
    @ResponseBody
    public Map searchSelf(String page, String rows,String field,String fieldValue){
        return siteConsumptionDetailsManager.searchSelf(page,rows,field,fieldValue);
    }

    @RequestMapping("/searchMoreSelf")
    @ResponseBody
    public Map searchMoreSelf(String page, String rows,String fieldValue){
        return siteConsumptionDetailsManager.searchMoreSelf(page,rows,fieldValue);
    }

    @RequestMapping("/getSumTotal")
    @ResponseBody
    public int getSumTotal(){
        return siteConsumptionDetailsManager.getSumTotal();
    }
}
